#ifndef LINEAR_SYSTEM_H
#define LINEAR_SYSTEM_H

#include <map>
#include <string>
#include <vector>

#include "linear_equation.h"

using namespace std;

/** This class is used to store and manipulate a systems of linear equations.
 *  It performs a reduction of the system by the algorithm of Gauss-Seidel.
 *  which allows getting the solution if there is a unique one, or to know
 *  if there are multiple or none solutions at all. 
 */

class LinearSystem {
 public:
  /** This method reads a Linear System from standard input. */
  static LinearSystem* ReadLinearSystemFromStdin(int, int, string&);
  /** This method applies Gauss-Seidel to the current system. */
  LinearSystem* Resolve();
  /** This method prints a system matrix to standard output. */
  void PrintSystemToStdout();
  /** This mthod prints data about the solution of the matrix.
   *  In case there is a unique solution it prints it, otherwise,
   *  it tells that there are none or multiple solutions.
   */
  void PrintSolutionToStdout();

 private:
  int number_of_equations_;
  int number_of_variables_;
  vector<LinearEquation> system;
  vector<string> variables;
  map<string, int> variable_column;
};

#endif  // LINEAR_EQUATION_H
